//Perhaps the most popular package in NuGet that supports TAR is SharpZipLib.
//Its wiki includes examples for working with tar.gz files, including creation.
//The linked example archives an entire folder.
//To archive a single file, the sample can be simplified to this:
private void CreateTarGZ(string tgzFilename, string fileName)
{
using (var outStream = File.Create(tgzFilename))
using (var gzoStream = new GZipOutputStream(outStream))
using (var tarArchive = TarArchive.CreateOutputTarArchive(gzoStream))
{
tarArchive.RootPath = Path.GetDirectoryName(fileName);
var tarEntry = TarEntry.CreateEntryFromFile(fileName);
tarEntry.Name = Path.GetFileName(fileName);
tarArchive.WriteEntry(tarEntry,true);
}
}